package com.thread.thread;

import org.springframework.boot.test.context.SpringBootTest;

/**
 * Java实现多线程的方式2
 * 实现Runnable接口，重写run方法
 */
@SpringBootTest
public class StartRunnable implements Runnable{
    @Override
    public void run(){
        //此处为thread执行的任务内容
        for (int i = 0; i < 200; i++) {
            System.out.println("多线程测试"+i);
        }
    }

    public static void main(String[] args) {
        StartRunnable sr = new StartRunnable();
        new Thread(sr).start();
        for (int i = 0; i < 1000; i++) {
            System.out.println("主线程测试"+i);
        }
    }
}
